package com.msb.serviceDriverUser.controller;

import com.alibaba.fastjson.JSON;
import com.msb.internalcommon.dto.DriverUser;
import com.msb.internalcommon.dto.ResponseResult;
import com.msb.serviceDriverUser.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Auther: WuWen
 * @Date: 2023/8/22 - 08 - 22 - 14:57
 * @Description: com.msb.serviceDriverUser.controller
 * @version: 1.0
 */
@RestController
@Slf4j
public class UserController {

    @Autowired
    private UserService userService;

    @PostMapping("/user")
    public ResponseResult addDriverUser(@RequestBody DriverUser driverUser){
        log.info(JSON.toJSONString(driverUser));
        return userService.addDriverUser(driverUser);
    }

    @PutMapping("/user")
    public ResponseResult updateUser(@RequestBody DriverUser driverUser){
        log.info(JSON.toJSONString(driverUser));

        return userService.updateDriverUser(driverUser);
    }

}
